<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('前台操作日志列表')"/>
    <th:block th:include="include :: bootstrap-select-css"/>
</head>
<body class="gray-bg">
<div class="container-div">
    <div class="row">
        <div class="col-sm-12 search-collapse">
            <form id="operlog-form">
                <div class="select-list">
                    <ul>
                        <li>
                            <label>系统模块： </label><input type="text" name="lm"/>
                        </li>
                        <li class="select-selectpicker" style="display: none">
                            <label>操作类型： </label><select id="businessTypes"
                                                         class="selectpicker" data-none-selected-text="请选择" multiple name="execType">
                            <option value="0">RequestMapping</option>
                            <option value="3">PutMapping</option>
                            <option value="4">DeleteMapping</option>
                            <option value="2">GetMapping</option>
                            <option value="1">PostMapping</option>
                            <option value="-1">Else</option>
                        </select>
                        </li>
                        <li>
                            <label>业务状态：</label><select name="st">
                            <option value="">所有</option>
                            <option value="0">成功</option>
                            <option value="1">失败</option>
                            <option value="2">未知</option>
                        </select>
                        </li>
                        <li class="select-time">
                            <label>业务时间： </label>
                            <input type="text" class="time-input" id="startTime" placeholder="开始时间"
                                   name="params[beginTime]"/>
                            <span>-</span>
                            <input type="text" class="time-input" id="endTime" placeholder="结束时间"
                                   name="params[endTime]"/>
                        </li>
                        <li>
                            <a class="btn btn-primary btn-rounded btn-sm" onclick="searchPre()"><i
                                    class="fa fa-search"></i>&nbsp;搜索</a>
                            <a class="btn btn-warning btn-rounded btn-sm" onclick="resetPre()"><i
                                    class="fa fa-refresh"></i>&nbsp;重置</a>
                        </li>
                    </ul>
                </div>
            </form>
        </div>

        <div class="btn-group-sm" id="toolbar" role="group">
            <a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()">
                <i class="fa fa-remove"></i> 删除
            </a>
            <a class="btn btn-danger" onclick="$.operate.clean()">
                <i class="fa fa-trash"></i> 清空
            </a>
            <a class="btn btn-warning" onclick="$.table.exportExcel()" >
                <i class="fa fa-download"></i> 导出
            </a>
        </div>

        <div class="col-sm-12 select-table table-striped">
            <table id="bootstrap-table"></table>
        </div>
    </div>
</div>

<th:block th:include="include :: footer"/>
<th:block th:include="include :: bootstrap-select-js"/>
<script th:inline="javascript">
    $(function () {
        var options = {
            url: "/monitor/operlog/queryBusinesslog",
            queryParams: queryParams,
            sortName: "business_log_time",
            sortOrder: "desc",
            modalName: "业务日志",
            detailUrl:  "/monitor/operlog/detailBusiness/{id}",
            escape: true,
            showPageGo: true,
            method:"get",
            rememberSelected: true,
            columns: [{
                field: 'state',
                checkbox: true
            },
                {
                    field: 'business_log_id',
                    title: '日志编号'
                },
                {
                    field: 'business_log_module',
                    title: '系统模块'
                },
                {
                    field: 'business_log_status',
                    title: '业务状态',
                    align: 'center',
                    formatter: function (value, row, index) {
                        if (value == 0) {
                            return '<span class="badge badge-primary">成功</span>';
                        } else if (value == 1) {
                            return '<span class="badge badge-danger">失败</span>';
                        }else if(value==2){
                            return  '<span class="badge badge-info">未知</span>';
                        }
                    }
                },
                {
                    field:'business_log_user_id',
                    title:'业务人编号'
                },
                {
                    field: 'business_log_time',
                    title: '业务时间',
                    sortable: true
                },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function(value, row, index) {
                        var actions = [];
                        actions.push('<a class="btn btn-warning btn-xs  " href="javascript:void(0)" onclick="$.operate.detail(\'' + row.business_log_id + '\')"><i class="fa fa-search"></i>详细</a>');
                        return actions.join('');
                    }
                }
            ]
        };
        $.table.init(options);
    });

    function queryParams(params) {
        var search = $.table.queryParams(params);
        search.businessTypes = $.common.join($('#businessTypes').selectpicker('val'));
        return search;
    }

    function searchPre() {
        $.table.search('operlog-form', 'bootstrap-table');
    }

    function resetPre() {
        $("#operlog-form")[0].reset();
        $("#businessTypes").selectpicker('refresh');
        $.table.search('operlog-form', 'bootstrap-table');
    }
</script>
</body>
</html>